import {
  createRouter,
  createWebHistory,
  type RouteRecordRaw,
} from "vue-router";
import Layout from "@/components/layout/index.vue";
import GoodPage from "@/pages/good/index.vue";
import CategoryPage from "@/pages/category/index.vue";
import OrderPage from "@/pages/order/index.vue";
import LoginPage from "@/pages/login/index.vue";
import RegisterPage from "@/pages/register/index.vue";

const routes: RouteRecordRaw[] = [
  { path: "/login", component: LoginPage },
  { path: "/register", component: RegisterPage },
  {
    path: "/",
    component: Layout,
    children: [
      { path: "good", component: GoodPage },
      { path: "category", component: CategoryPage },
      { path: "order", component: OrderPage },
      { path: "", redirect: "/good" },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
